package com.pitb.citizenreporting;

import java.util.StringTokenizer;

import android.text.TextUtils;

public class UserLocation {
	public double latitude ;
	public double longitude ;
	
	public static UserLocation getUserLocation(String response){
		if(TextUtils.isEmpty(response)){
			return null ;
		}
		
		if(!response.contains(",")){
			return null ;
		}
		
		StringTokenizer tokens = new StringTokenizer(response, ",");
		if(tokens.hasMoreElements()){
			tokens.nextToken();
			tokens.nextToken();
			String lat = tokens.nextElement().toString();
			String lng = tokens.nextElement().toString();
			UserLocation loc = new UserLocation();
			loc.latitude = Double.parseDouble(lat);
			loc.longitude = Double.parseDouble(lng);
			return loc ;
		}
		
		return null ;
	}
}
